const request = require("./http.js");

var getbalance = function (id,callback) {
  request({
    url: "/mall/membershipLevelCustomer/getMemberByCustomerId?customerId="+id,
    method: "get",
    success: function (res) {
      callback(res);
    },
    fail: function (err) {
      console.log(err);
      wx.showToast({
        title: err.errMsg,
        icon: "none",
        duration: 2000,
      });
    },
  });
};
var getmemberInfo = function (id,callback) {
  request({
    url: "/mall/membershipLevelCustomer/AccessMemberInformation?customerId="+id,
    method: "get",
    success: function (res) {
      callback(res);
    },
    fail: function (err) {
      console.log(err);
      wx.showToast({
        title: err.errMsg,
        icon: "none",
        duration: 2000,
      });
    },
  });
};
var memberDaybook =  function (data, callback) {
  request({
    url: "/mall/membershipLevelCustomer/getCustomerList",
    method: "post",
    data: data,
    success: function (res) {
      callback(res);
    },
    fail: function (err) {
      console.log(err);
      wx.showToast({
        title: err.errMsg,
        icon: "none",
        duration: 2000,
      });
    },
  });
};
var memberPay = function (data, callback) {
  request({
    url: "/mall/pay/memberpayPay",
    method: "post",
    data: data,
    success: function (res) {
      callback(res);
    },
    fail: function (err) {
      console.log(err);
      wx.showToast({
        title: err.errMsg,
        icon: "none",
        duration: 2000,
      });
    },
  });
};
var getpaylist=function (data, callback) {
  request({
    url: "/mall/rechargerules/rechargerulesList",
    method: "post",
    data: data,
    success: function (res) {
      callback(res);
    },
    fail: function (err) {
      console.log(err);
      wx.showToast({
        title: err.errMsg,
        icon: "none",
        duration: 2000,
      });
    },
  });
};
module.exports = {
  getbalance:getbalance,//获取余额
  getmemberInfo:getmemberInfo,//获取会员信息
  memberDaybook:memberDaybook,//会员流水
  memberPay:memberPay,//充值
  getpaylist:getpaylist,//获取充值列表
}